package com.sumainfor.wx.system.epc.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.common.utlis.PageUtils;
import com.sumainfor.common.utlis.Pager;
import com.sumainfor.wx.system.epc.service.RepairService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/6/12 12:06
 * @Description:
 */
@RestController
@RequestMapping("/repair")
public class RepairController {

    @Autowired
    RepairService RepairService;

    /**
     * 功能描述: 
     * 获取当前服务中心维修工单池列表
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/6/12 12:08
     */
    @GetMapping("/getRepairList")
    public JsonResult getRepairList(@RequestParam Map<String,Object> params, Pager pager){
        JsonResult result=new JsonResult();
        pager.setPagerNecessary(params, pager);
        PageUtils pageUtils = new PageUtils();
        Integer cout=RepairService.getRepairListCount(params);
        if(cout==0){
            return pageUtils.getJsonResult(new ArrayList<Map<String,Object>>(), params,cout);
        }
        List<Map<String,Object>> getRepairList=RepairService.getRepairList(params);
        result=pageUtils.getJsonResult(getRepairList, params, cout);
        return result;
    }
}
